{include file="common/head"/}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>
    {include file="common/left"}
    <div class="main-content">
        <div class="main-content-inner">
            {include file="common/header_nav"}
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="col-xs-12">
                                <form id="ruleorder" name="ruleorder" method="post" action="{:url('ruleorder')}">
                                    <div class="table-responsive">
                                        <table id="dynamic-table" class="table table-striped table-bordered table-hover center">
                                            <thead>
                                            <tr>
                                                <th class="center wh90">排序</th>
                                                <th class="center visible-lg visible-md">ID</th>
                                                <th class="text-left">栏目名称</th>
                                                <th class="center visible-lg visible-md">所属模型</th>
                                                <th class="center visible-lg visible-md">导航</th>
                                                <th class="center" style="border-right:1px solid #ddd;width: 120px; ">操作</th>
                                            </tr>
                                            </thead>

                                            <tbody>
                                            {$categorys}
                                            <tr>
                                                <td colspan="8" align="left">
                                                    <button type="submit" id="btnorder" class="btn btn-white btn-yellow btn-sm">排序</button>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </form>
                            </div><!-- /.span -->
                        </div><!-- /.row -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div>
        </div>
    </div>
    {include file="common/foot" /}
</div>
<script>
    function del(id) {
        layer.confirm('你确定要删除该栏目及其子栏目吗？', {icon: 3}, function (index) {
            $.post('{:url("del")}', {id: id}, function (data) {
                if (data.status == 1) {
                    layer.alert(data.info, {icon: 6}, function(index){
                        layer.close(index);
                        window.location.href=data.url;
                    });
                }else{
                    layer.msg(data.info,{icon:5});
                }
            });
            layer.close(index);
        });
    }
    $(function(){
        $('#ruleorder').ajaxForm({
            beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: complete, // 这是提交后的方法
            dataType: 'json'
        });

        function checkForm(){
        }
        function complete(data){
            if(data.status==1){
                layer.alert(data.info, {icon: 6}, function(index){
                    layer.close(index);
                    window.location.href=data.url;
                });
            }else{
                layer.alert(data.info, {icon: 5}, function(index){
                    layer.close(index);
                });
                return false;
            }
        }

    });
</script>
</body>
</html>
